const api = require('../utils/request.js')

module.exports = {
  // 我的预约列表查询
  reservationList(){
    return api.request({
      url: '/wechat/appointment/list',
      method: 'GET'
    })
  },
  // 我的收藏列表查询接口
  collectList(userId){
    return api.request({
      url: `/wechat/collect/list/${userId}`,
      method: 'GET'
    })
  },
  // 字典查询接口
  dictList(dictType){
    return api.request({
      url: `/wechat/dict/data/type/${dictType}`
    })
  },
  //查询设施
  facilityTypeList() {
    return api.request({
      url: '/wechat/facilityType/list',
      method: 'GET'
    })
  },
  //修改登录信息
  updateUserInfo: function (data) {
    return api.request({
      url: `/wechat/updateUserInfo`,
      method: 'POST',
      data: data
    })
  },
  // 获取营地列表
  campList(params = {}) {
    console.log('params',params);
    return api.request({
      url: '/wechat/camp/list',
      method: 'GET',
      data: params
    })
    
  }, // 营地列表并按点击次数排序
  campListSort() {
    return api.request({
      url: '/wechat/camp/sort',
      method: 'GET'
      
    })
    
  },
  // 广告banner列表
  getBannerList() {
    return api.request({
      url: '/wechat/banner/list',
      method: 'GET'
    })
  },
  //获取服务设施信息
  getFacilityType() {
    return api.request({
      url: '/wechat/facilityType/list',
      method: 'GET'
    })
  },
  // 上传服务设施
  addService(data){
    return api.request({
      url:"/wechat/facilityType/add",
      method:"POST",
      data
    })
  },
 
  // 新增营地
  addCamp(data){
    console.log('data',data);
    return api.request({
      url:'/wechat/camp',
      method:'POST',
      data
    })
  },
    // 删除营地
    deleteCamp(campId) {
      return api.request({
        url: `/wechat/camp/${campId}`,
        method: 'delete'
      })
    },
    // 修改营地
  updateCamp(data) {
    return api.request({
      url: "/wechat/camp",
      method: "POST",
      data
    })
  },
  //上传服务
  addFacility(data){
    return api.request({
      url:'/wechat/facilityType/add',
      method:'POST',
      data
    })
  },
  //营地服务设施
  serviceFacilities() {
    return api.request({
      url:"/wechat/facility/list",
    })
  },
  // 营地详情
  campDetail(campId){
    return api.request({
      url: `/wechat/camp/count/${campId}`,
      method: 'GET'
    })
  },
  // 用营地id查询营位信息
  getCampCampsite(id) {
    console.log(id)
    return api.request({
      url: `/wechat/campsite/list?campId=` + id,
      method: 'GET'
    })
  },
  getSpots(campId) {
    return api.request({
      url: `/wechat/spots/getInfoByCampId/${campId}`,
      method: 'GET'
    })
  },
   // 活动列表 /wechat/activity/getInfoByCampId/{campId}
   getActivity(campId) {
     console.log(campId,'campId');
    return api.request({
      url: `/wechat/activity/getInfoByCampId/${campId}`,
      method: 'GET'
    })
  },
  // 其他项目 /wechat/project/getInfoByCampId/{campId}
  getProject(campId) {
    return api.request({
      url: `/wechat/project/getInfoByCampId/${campId}`,
      method: 'GET'
    })
  },
   //获取营地服务设施选择数据
   getFacilitiesA(id) {
    return api.request({
      url: `/wechat/facilityType/getInfo/` + id,
      method: 'GET'
    })
  },
   //营地营位添加
   campAddCampsite(data) {
    return api.request({
      url: '/wechat/campsite',
      method: 'post',
      data
    })
  },
    //营地营位删除
    campDelCampsite(campsiteId) {
      return api.request({
        url: '/wechat/campsite/' + campsiteId,
        method: 'delete'
      })
    },
  getCampsiteList: function (query) {
    return api.request(
      "/wechat/campsite/list",
      "get",
      query
    )
  },
  // 景点添加
  addScenic(data) {
    return api.request({
      url: `/wechat/spots/add`,
      method: 'post',
      data
    })
  },
  // 景点删除
  campDelScenic(scenicId) {
    return api.request({
      url: '/wechat/spots/' + scenicId,
      method: 'delete'
    })
  },
  //添加活动
  addActivity(data) {
    return api.request({
      url: `/wechat/activity/add`,
      method: 'post',
      data
    })
  },
   // 删除活动
   campDelActivity(activityId) {
    return api.request({
      url: '/wechat/activity/' + activityId,
      method: 'delete'
    })
  },
    // 项目添加
    addOtherProject(data) {
      return api.request({
        url: `/wechat/project/add`,
        method: 'post',
        data
      })
    },
     // 项目删除
  campDelProject(projectId) {
    return api.request({
      url: '/wechat/project/' + projectId,
      method: 'delete'
    })
  },
  // 收藏营地 与取消收藏
  collectCamp(data) {
   
    return api.request({
      url: '/wechat/collect',
      method: 'post',
      data
    })
  },
    // 取消收藏营地
    removeCollectCamp(data) {
      return api.request({
        url: '/wechat/collect',
        method: 'POST',
        data
      })
    },
  addAppointment(data){
    console.log(data,'data');
    return api.request({
      url:'/wechat/appointment',
      method:'post',
      data
    })
  },
  campUpInfo(params) {
    return api.request({
      url: '/wechat/camp',
      method: 'put',
      data: {
        "campId":params.campId ,
        "address": params.address,
        "campName": params.campName,
        "campType": params.campType,
        "imageUrl": params.imageUrl,
        "introduce": params.introduce,
        "latitude": params.latitude,
        "location": params.location,
        "longitude": params.longitude,
        "linkman": params.linkman,
        "phone": params.phone,
        "specificTime": params.timeType,
        "userId": params.userId,
        "userType": params.userType
      }
    })
  },
  
    
}